package cn.tedu.oop;

/**
 * @author ：Dsi
 * @date ：2021/11/8 14:03
 */
public class TestDog {
    public static void main(String[] args) {
        Dog d=new Dog();//调用无参构造
        d.play();
        d.play("我");
        d.play(5, "翔");
        d.play("你",23);

        Dog d1=new Dog(520);
        Dog d2=new Dog("a",45,420);

        }
    }


class Dog{
    String name;
    int age;
    double price;

    public Dog(){
        System.out.println("我是无参构造");
    }
    public Dog(int a){
        System.out.println("我是含参构造"+a);
    }
    public Dog(String name, int age, double price) {
        this.name = name;
        this.age = age;
        this.price = price;
        System.out.println("我是全参构造"+name);
    }
    public void play(){
        System.out.println("小狗喜欢玩飞盘~~");
    }
    public void play(String host){
        System.out.println("小狗喜欢和主人"+host+"一起玩飞盘");
    }
    public void play(int n,String food){
        System.out.println("小狗今晚要吃"+n+"份"+food);
    }
    public void play(String name,int age){
        System.out.println("小狗"+name+"今年"+age+"岁了");
    }
}